const BASE_URL = 'https://school-xingyue.asia'
// const BASE_URL = 'http://39.98.162.10:9090'
// const BASE_URL = 'http://localhost:9090'
export const myRequest = (options) => {
	return new Promise((resolve, reject) => {

		var headers = {
			// 'content-type': 'application/x-www-form-urlencoded',
			'Content-Type': 'application/json;charset=UTF-8',
			'Connection': 'close',
			'Content-Length' : '70',
		};

		// let userToken = uni.getStorageSync('token')
		// let user = uni.getStorageSync('user')
		// let settings = uni.getStorageSync('settings')

		// if (!userToken || !user || !settings) {
		// 	uni.reLaunch({
		// 		url: '/pages/login/login'
		// 	})
		// }

		uni.request({
			url: BASE_URL + options.url,
			method: options.method || 'GET',
			data: options.data || {},
			// header: {
			// 	token: userToken,
			// },
			success: (res) => {
				// if (res.data === '') {
				// 	return uni.showToast({
				// 		title: "token过期，从新登陆",
				// 		icon: "none"
				// 	})

				// }
				resolve(res)
			},
			fail: (err) => {
				uni.showToast({
					title: '请求接口失败'
				})
				reject(err)
			}
		})
	})
}
